program pii;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  x, y, p: real;
  i, n0, n: integer;
  fin: textfile;

begin
  randomize;
  n:=0;
  n0:=0;
  assignfile(fin, 'op.txt');
  rewrite(fin);
  for i:=1 to 10000000 do
  begin
    x:=2*random;
    y:=2*random;
    if ((x-1)*(x-1)+(y-1)*(y-1)<1) then
      n0:=n0+1;
    n:=n+1;
    if (i mod 10000=0) then
    begin
      p:=pi-4*n0/n;
      writeln(fin, i, ',', p:0:9);
    end;
  end;
  closefile(fin);
  readln;
end.

